from datetime import date, datetime

"""
日期字段公用方法
"""


def date2str(origin_date, fmt='%Y%m%d'):
    """日期转字符串，默认格式年月日"""
    if origin_date is not None and (type(origin_date) is datetime or type(origin_date) is date):
        return origin_date.strftime(fmt)
    return None

